<template>
  <div>
    <!--验收信息-->
    <div>
      <el-card class="box-cardxx">
        <div slot="header" class="clearfix">
          <span>验收信息</span>
        </div>
        <el-form :module="form" label-width="100px">
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="验收单号" required>
                <el-input placeholder="系统自动生成" disabled></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="验收主题" required>
                <el-input placeholder="请输入" v-model="form.topic"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="验收日期">
                <el-date-picker placeholder="请选择日期" v-model="form.date" style="width: 100%;"></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="验收人员" required>
                <el-input v-model="form.acceptor" placeholder="柴豹子" @focus="centerDialogVisible = true"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="验收部门" required>
                <el-input v-model="form.department" placeholder="验收部门" @focus="centerDialogVisible2 = true"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="采购单号">
                <el-input v-model="form.purchase" placeholder="请选择" suffix-icon="el-icon-search"
                  @focus="dialogVisiblefg = true"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="备注">
                <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" cols="8" rows="4"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </el-card>
    </div>
    <!--选择订单-->
    <el-dialog title="选择采购订单" :visible.sync="dialogVisiblefg" width="65%">
      <div style="margin-bottom: 20px;">
        <el-input placeholder="请输入采购主题/单号" v-model="councode" style="width: 30%; margin-right: 10px;"></el-input>
        <el-select placeholder="请选择供应商" v-model="countype" style="width: 30%; margin-right: 10px;">
          <el-option label="类型1" value="1"></el-option>
          <el-option label="类型2" value="2"></el-option>
        </el-select>
        <el-select placeholder="请选择采购部门" v-model="countype" style="width: 30%; margin-right: 10px;">
          <el-option label="类型1" value="1"></el-option>
          <el-option label="类型2" value="2"></el-option>
        </el-select>
      </div>
      <div style="margin-bottom: 20px;">
        <el-date-picker v-model="value1" type="monthrange" range-separator="~" start-placeholder="开始月份"
          end-placeholder="结束月份" style="width: 285px; margin-right: 10px;">
        </el-date-picker>
        <el-input placeholder="采购人员" v-model="councode" style="width: 30%; margin-right: 10px;"></el-input>
        <el-button type="primary" style="margin-left: 200px;" @click="search">查询</el-button>
        <el-button @click="reset">重置</el-button>
      </div>
      <el-table :data="tableDataAcc" ref="registTable2" stripe style="width: 100%;" size="mini"
        :cell-style="{ padding: '0px' }" :row-style="{ height: '35px' }" highlight-current-row
        @current-change="handleCurrentChange4e">
        <el-table-column label="序号" width="60" align="center">
          <template v-slot="scope">
            {{ scope.$index + 1 }}
          </template>
        </el-table-column>
        <el-table-column prop="code" label="采购单号" align="center"></el-table-column>
        <el-table-column prop="procurementTopics" label="采购主题" align="center"></el-table-column>
        <el-table-column prop="datePurchase" label="采购日期" align="center"></el-table-column>
        <el-table-column prop="department" label="采购部门" align="center"></el-table-column>
        <el-table-column prop="purchasingStaff" label="采购人员" align="center"></el-table-column>
        <el-table-column prop="vendor" label="供货商" align="center"></el-table-column>
      </el-table>
      <div style="text-align: right; margin-top: 20px;">
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
          :page-sizes="[10, 20, 30, 40]" :page-size="10" layout="total, sizes, prev, pager, next, jumper"
          :total="total"></el-pagination>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisiblefg = false">取消</el-button>
        <el-button type="primary" @click="confirm24">确认</el-button>
      </div>
    </el-dialog>
    <div>
      <el-card class="box-card2tt">
        <div slot="header" class="clearfix">
          <span>设备明细</span>
        </div>
        <el-button @click="dialogVisible2 = true">添加</el-button>
        <el-button @click="removeSelected">移除</el-button>
        <el-table :data="tableData3" ref="registTable2g" stripe style="width: 100%">
          <el-table-column type="selection" width="55" align="center" fixed></el-table-column>
          <!-- <el-table-column prop="id" label="id" width="60" align="center" fixed></el-table-column> -->
          <el-table-column label="序号" width="60" align="center" fixed>
            <template v-slot="scope">
              {{ scope.$index + 1 }}
            </template>
          </el-table-column>
          <el-table-column label="操作" width="120" align="center" fixed>
            <template slot-scope="scope">
              <el-link type="danger" @click="AddEWwq(scope.row, scope.$index)">验收</el-link>
              <el-link type="danger" @click="removeRow(scope.$index)" style="margin-left: 20px;">移除</el-link>
            </template>
          </el-table-column>
          <el-table-column prop="jieg" label="验收结果" align="center" width="120"></el-table-column>
          <el-table-column prop="actual" label="购买数量" align="center" width="120"></el-table-column>
          <el-table-column prop="daohuo" label="已到货数量" align="center" width="120"></el-table-column>
          <el-table-column prop="weidaohuo" label="未到货数量" align="center" width="120"></el-table-column>
          <el-table-column prop="numbering" label="设备编号" align="center" width="120"></el-table-column>
          <el-table-column prop="name" label="设备名称" align="center" width="120"></el-table-column>
          <el-table-column prop="model" label="规格型号" align="center" width="120"></el-table-column>
          <el-table-column prop="type" label="设备类型" align="center" width="120"></el-table-column>
          <el-table-column prop="manufacture" label="制造国别" align="center" width="120"></el-table-column>
          <el-table-column prop="manufacturer" label="生产厂家" align="center" width="120"></el-table-column>
          <el-table-column prop="brand" label="品牌" align="center" width="120"></el-table-column>
          <el-table-column prop="dateofManufacture" label="出厂日期" align="center" width="120"></el-table-column>
          <el-table-column prop="factoryNumber" label="出厂编号" align="center" width="120"></el-table-column>
          <el-table-column prop="weight" label="(吨)" align="center" width="120"></el-table-column>
          <el-table-column prop="actualPrice" label="采购单价" align="center" width="120"></el-table-column>
          <el-table-column prop="actual" label="购买数量" align="center" width="120"></el-table-column>
          <el-table-column prop="actualTotal" label="金额" align="center" width="120"></el-table-column>
          <el-table-column prop="useDepartments" label="使用部门" align="center" width="120"></el-table-column>
          <el-table-column prop="theEquipment" label="设备负责人" align="center" width="120"></el-table-column>
          <el-table-column prop="qingk" label="验收情况" align="center" width="120"></el-table-column>
          <el-table-column prop="remark" label="备注" align="center" width="120"></el-table-column>
          <el-table-column label="随附附件" align="center" width="120">
            <template slot-scope="scope">
              <el-link type="primary" @click="fujian(scope.$index)">添加</el-link>
            </template>
          </el-table-column>
        </el-table>
        <div style="margin-top: 20px; text-align: right;">
          本次到货数量：<span style="color: red;">5</span>
        </div>
      </el-card>
      <!--添加采购货物-->
      <el-dialog title="采购订单设备列表" :visible.sync="dialogVisible2" width="60%">
        <div style="margin-bottom: 20px;">
          <el-input placeholder="请输入设备编号/名称/规格型号" v-model="councode" style="width: 30%; margin-right: 10px;"></el-input>
          <el-select placeholder="请选择设备类型" v-model="countype" style="width: 30%; margin-right: 10px;">
            <el-option label="类型1" value="1"></el-option>
            <el-option label="类型2" value="2"></el-option>
          </el-select>
          <el-button type="primary" style="margin-left: 10px;" @click="search">查询</el-button>
          <el-button @click="reset">重置</el-button>
          <el-select placeholder="请选择使用部门" v-model="counbu" style="width: 30%;">
            <el-option label="部门1" value="1"></el-option>
            <el-option label="部门2" value="2"></el-option>
          </el-select>
        </div>
        <el-table :data="tableData" ref="registTable2" stripe style="width: 100%;" size="mini"
          :cell-style="{ padding: '0px' }" :row-style="{ height: '35px' }" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55" align="center"></el-table-column>
          <el-table-column label="序号" width="60" align="center">
            <template slot-scope="scope">
              {{ scope.$index + 1 }}
            </template>
          </el-table-column>
          <el-table-column prop="numbering" label="设备编号" align="center"></el-table-column>
          <el-table-column prop="name" label="设备名称" align="center"></el-table-column>
          <el-table-column prop="model" label="规格型号" align="center"></el-table-column>
          <el-table-column prop="type" label="设备类型" align="center"></el-table-column>
          <el-table-column prop="reference" label="采购单价" align="center"></el-table-column>
          <el-table-column prop="quantity" label="采购数量" align="center"></el-table-column>
          <el-table-column prop="estimate" label="金额" align="center"></el-table-column>
        </el-table>
        <div style="text-align: right; margin-top: 20px;">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :current-page="currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="10"
            layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
        </div>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible2 = false">取消</el-button>
          <el-button type="primary" @click="confirm2">确认</el-button>
        </div>
      </el-dialog>
      <!--添加附件-->
      <el-dialog title="添加随附附件" :visible.sync="dialogVisible" width="75%">
        <el-button @click="addRow2">添加</el-button>
        <el-button @click="removeSelected2r">移除</el-button>
        <el-table :data="tableData2" ref="registTable" stripe style="width: 100%; margin-top: 20px;" size="mini"
          :cell-style="{ padding: '0px' }" :row-style="{ height: '35px' }">
          <el-table-column type="selection" width="55" align="center"></el-table-column>
          <el-table-column label="序号" width="60" align="center">
            <template slot-scope="scope">
              {{ scope.$index + 1 }}
            </template>
          </el-table-column>
          <el-table-column label="操作" width="80" align="center">
            <template slot-scope="scope">
              <el-link type="danger" @click="removeRow2(scope.$index)">移除</el-link>
            </template>
          </el-table-column>
          <el-table-column prop="numbering" label="附件编号" align="center"></el-table-column>
          <el-table-column prop="name" label="附件名称" align="center" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.name" placeholder="请输入"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="model" label="规格型号" align="center" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.model" placeholder="请输入"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="type" label="附件类型" align="center" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.type" placeholder="请选择" style="width: 100%;">
                <el-option label="类型1" value="1"></el-option>
                <el-option label="类型2" value="2"></el-option>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column prop="quantity" label="数量" align="center" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.quantity" placeholder="请输入"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="remark" label="备注" align="center" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.remark" placeholder="请输入"></el-input>
            </template>
          </el-table-column>
        </el-table>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible = false">取消</el-button>
          <el-button type="primary" @click="confirm">确认</el-button>
        </div>
      </el-dialog>
    </div>
    <!--验收设备-->
    <el-dialog title="验收设备" :visible.sync="dialogVisible3" width="70%">
      <el-form :model="formData" label-width="120px" size="mini">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="设备名称" required>
              <el-input v-model="formData.name" placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="设备类型">
              <el-select v-model="formData.type" placeholder="请选择" style="width: 100%;">
                <el-option label="类型1" value="1"></el-option>
                <el-option label="类型2" value="2"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="生产厂家">
              <el-input v-model="formData.manufacturer" placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="出厂日期">
              <el-date-picker v-model="formData.dateofManufacture" placeholder="请选择日期"
                style="width: 100%;"></el-date-picker>
            </el-form-item>
            <el-form-item label="使用部门">
              <el-select v-model="formData.useDepartments" placeholder="请选择" style="width: 100%;">
                <el-option label="部门1" value="1"></el-option>
                <el-option label="部门2" value="2"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="总功率(kw)">
              <el-input v-model="formData.totalPower" placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="采购单价">
              <el-input v-model="formData.actualPrice" disabled></el-input>
            </el-form-item>
            <el-form-item label="金额">
              <el-input v-model="formData.actualTotal" disabled></el-input>
            </el-form-item>
            <el-form-item label="未到货数量">
              <el-input v-model="formData.weidaohuo"></el-input>
            </el-form-item>
            <el-form-item label="到货日期">
              <el-date-picker v-model="formData.daoqi" placeholder="请选择日期" style="width: 100%;"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="规格型号" required>
              <el-input v-model="formData.model" placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="制造国家">
              <el-input v-model="formData.manufacture" placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="品牌">
              <el-input v-model="formData.brand" placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="出厂编号">
              <el-input v-model="formData.factoryNumber" placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="设备负责人">
              <el-input v-model="formData.theEquipment" placeholder="请输入" @click.native="xuanz"></el-input>
            </el-form-item>
            <el-form-item label="重量(吨)">
              <el-input v-model="formData.weight" placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="采购数量">
              <el-input v-model="formData.actual" disabled></el-input>
            </el-form-item>
            <el-form-item label="已到货数量">
              <el-input v-model="formData.daohuo"></el-input>
            </el-form-item>
            <el-form-item label="本次到货数量">
              <el-input v-model="formData.benci" placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="验收结果" required>
              <el-select v-model="formData.jieg" placeholder="请选择" style="width: 100%;">
                <el-option label="合格" value="合格"></el-option>
                <el-option label="不合格" value="不合格"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="验收情况" required>
              <el-input type="textarea" v-model="formData.qingk" placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="备注">
              <el-input type="textarea" v-model="formData.remark" placeholder="请输入"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible3 = false">取消</el-button>
        <el-button type="primary" @click="confirmff">确认</el-button>
      </div>
    </el-dialog>

    <!--选择部门弹窗-->
    <el-dialog :visible.sync="centerDialogVisible2" title="选择人员" width="500px">
      <el-input v-model="search2" placeholder="请输入搜索" prefix-icon="el-icon-search"
        style="margin-bottom: 10px;"></el-input>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-tree :data="treeData2" :props="defaultProps2" node-key="id" highlight-current default-expand-all
            @node-click="handleNodeClick2">
          </el-tree>
        </el-col>
        <el-col :span="12">
          <el-card shadow="never" class="box-card5">
            <div slot="header" class="clearfix">
              <span>已选对象 {{ selectedNodes2.length }}</span>
              <el-button type="text" @click="clearSelection2" style="float: right; padding: 3px 0;">清空</el-button>
            </div>
            <el-tag v-for="(node, index) in selectedNodes2" :key="index" closable @close="removeNode2(node)">
              {{ node.label }}
            </el-tag>
          </el-card>
        </el-col>
      </el-row>
      <div slot="footer" class="dialog-footer">
        <el-button @click="centerDialogVisible2 = false">取消</el-button>
        <el-button type="primary" @click="confirmSelection23">确认</el-button>
      </div>
    </el-dialog>

    <!--选择人员弹窗-->
    <el-dialog :visible.sync="centerDialogVisible" title="选择人员" width="500px">
      <el-input v-model="search" placeholder="请输入搜索" prefix-icon="el-icon-search"
        style="margin-bottom: 10px;"></el-input>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-tree :data="treeData" :props="defaultProps" node-key="id" highlight-current default-expand-all
            @node-click="handleNodeClick">
          </el-tree>
        </el-col>
        <el-col :span="12">
          <el-card shadow="never" class="box-card5">
            <div slot="header" class="clearfix">
              <span>已选对象 {{ selectedNodes.length }}</span>
              <el-button type="text" @click="clearSelection" style="float: right; padding: 3px 0;">清空</el-button>
            </div>
            <el-tag v-for="(node, index) in selectedNodes" :key="index" closable @close="removeNode(node)">
              {{ node.label }}
            </el-tag>
          </el-card>
        </el-col>
      </el-row>
      <div slot="footer" class="dialog-footer">
        <el-button @click="centerDialogVisible = false">取消</el-button>
        <el-button type="primary" @click="confirmSelection">确认</el-button>
      </div>
    </el-dialog>

    <!--关联文件-->
    <div>
      <el-card class="box-card3xx">
        <div slot="header" class="clearfix">
          <span>关联文件</span>
        </div>
        <el-button-group style="margin-bottom: 20px;">
          <el-upload ref="upload2" action="http://localhost:9289/maintenance/upload2" :on-success="handleUploadSuccess2"
            :file-list="fileList" :auto-upload="true" :show-file-list="false" :before-upload="beforeUpload">
            <el-button type="primary">上传文档</el-button>
          </el-upload>
          <el-button @click="removeSelectedRows2">移除</el-button>
        </el-button-group>
        <el-table :data="documents" style="width: 100%;" border @selection-change="handleSelectionChange2">
          <el-table-column type="selection" width="55"></el-table-column>
          <el-table-column type="index" label="序号" width="50"></el-table-column>
          <el-table-column prop="name" label="文件名"></el-table-column>
          <el-table-column prop="uploadDate" label="上传时间"></el-table-column>
          <el-table-column prop="uploader" label="上传者"></el-table-column>
          <el-table-column prop="size" label="文档大小"></el-table-column>
          <el-table-column label="操作" width="120">
            <template slot-scope="scope">
              <el-button type="text" @click="removeRow3(scope.$index)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-card>
    </div>
    <div style="height: 130px;">
      <el-footer class="footer">
        <el-button @click="handleCancel" style="margin-top: 20px; margin-left: -140px;">关闭</el-button>
        <el-button type="primary" @click="handleConfirm" style="margin-top: 20px; margin-left: 20px;">确认</el-button>
      </el-footer>
    </div>
  </div>
</template>

<script>
import { SelectListOrder, SelectOrderList, InsertAcceptance } from "@/api/eastjet-maintenance/dao/dao";
export default {
  data() {
    return {
      //表单数据
      form: {
        code: "",
        topic: "",
        date: "",
        acceptor: "",
        department: "",
        purchase: "",
        remark: "",
        tableData3: [],
        documents: [],//文档数据
      },
      //选择订单数据
      dialogVisible2tt: false,
      tableDataAcc: [],
      filteredData2: [],
      currentRow: null,
      //选择部门
      centerDialogVisible2: false,
      selectedNodes2: [],
      search2: "",
      TestSearch2: "",
      treeData2: [
        {
          label: 'XXXX科技有限公司',
          children: [
            {
              label: '项目部',
              children: [
                { label: '王虎部' },
                { label: '于红部' },
              ],
            },
            {
              label: '设计部',
              children: [
                { label: '丁坤部' },
                { label: '吴婷部' },
              ],
            },
            {
              label: '财务部',
              children: [
                { label: '马书奇部' },
                { label: '曹爽部' },
              ],
            },
            {
              label: '人事部',
              children: [
                { label: '王志强部' },
              ],
            },
          ],
        },
      ],
      //选择人员数据
      selectedNodes: [],
      TestSearch: "",
      search: "",
      treeData: [
        {
          label: 'XXXX科技有限公司',
          children: [
            {
              label: '项目部',
              children: [
                { label: '王虎' },
                { label: '于红' },
              ],
            },
            {
              label: '设计部',
              children: [
                { label: '丁坤' },
                { label: '吴婷' },
              ],
            },
            {
              label: '财务部',
              children: [
                { label: '马书奇' },
                { label: '曹爽' },
              ],
            },
            {
              label: '人事部',
              children: [
                { label: '王志强' },
              ],
            },
          ],
        },
      ],
      defaultProps: {
        children: 'children',
        label: 'label',
      },
      //人员选择弹窗
      centerDialogVisible: false,
      //验收设备
      dialogVisible3: false,
      //选择订单
      dialogVisiblefg: false,
      //保存验收结果
      listform: [],
      listform2: [],
      formData: {
        id: '',
        name: '',
        model: '',
        type: '',
        manufacture: '',
        manufacturer: '',
        brand: '',
        dateofManufacture: '',
        factoryNumber: '',
        useDepartments: '',
        theEquipment: '',
        totalPower: '',
        weight: '',
        actualPrice: '',
        actual: '',
        actualTotal: '',
        daohuo: '',
        weidaohuo: '',
        benci: '',
        daoqi: '',
        jieg: '',
        qingk: '',
        remark: '',
      },
      //添加采购货物
      dialogVisible2: false,
      countype: '',
      councode: '',
      counbu: '',
      currentPage: 1,
      total: 45,
      //设备选择明细
      tableData: [],
      //关联文件上传
      documents: [],
      fileList: [],
      multipleSelection: [],
      //附件初始化
      dialogVisible: false,
      tableData2: [
        {
          code: "自动生成编码",
          numbering: "自动生成编码",
          name: "",
          model: "",
          type: "",
          quantity: "",
          remark: "",
        },
      ],
      //
      tableData3: [],
      nan: {
        "state": "1",
        "code": "",
        pan: "1"

      },
      man: {
        "purchaseOrder": "",
      },
      kan: [],
      uindex: "",//获取添加附件下标
      pindex: "",//获取验收下标
    };
  },
  created() {
    this.getList();
  },
  methods: {
    //文件上传大小判断
    beforeUpload(file) {
      const isLt10M = file.size / 1024 / 1024 < 10;

      if (!isLt10M) {
        this.$message.error("上传文件大小不能超过 10MB!");
      }
      return isLt10M;
    },
    fujian(index) {
      this.uindex = index
      if (this.tableData3[index].tableData.length != 0) {
        this.tableData2 = this.tableData3[index].tableData
      } else {
        this.tableData2 = []
      }
      this.dialogVisible = true;
    },
    //验收确定
    confirmff() {
      this.tableData3[this.pindex].listData = []
      this.tableData3[this.pindex].listData.push({ ...this.formData })
      console.log("验收数据查看", this.tableData3)
      this.dialogVisible3 = false;
    },
    //验收
    AddEWwq(row, index) {
      this.pindex = index;
      this.formData.id = row.id;
      this.formData.name = row.name;
      this.formData.model = row.model;
      this.formData.type = row.type;
      this.formData.manufacture = row.manufacture;
      this.formData.manufacturer = row.manufacturer;
      this.formData.brand = row.brand;
      this.formData.dateofManufacture = row.dateofManufacture;
      this.formData.factoryNumber = row.factoryNumber;
      this.formData.useDepartments = row.useDepartments;
      this.formData.theEquipment = row.theEquipment;
      this.formData.totalPower = row.totalPower;
      this.formData.weight = row.weight;
      this.formData.actualPrice = row.actualPrice;
      this.formData.actual = row.actual;
      this.formData.actualTotal = row.actualTotal;
      this.formData.daohuo = row.daohuo;
      this.formData.weidaohuo = row.weidaohuo;
      this.formData.benci = row.benci;
      this.formData.daoqi = row.daoqi;
      this.formData.jieg = row.jieg;
      this.formData.qingk = row.qingk;
      this.formData.remark = row.remark;
      this.dialogVisible3 = true;
    },
    handleSelectionChange(val) {
      console.log('选中的行33:', val);
      this.filteredData2 = val;
    },
    getList() {
      SelectListOrder(this.nan).then((res) => {
        this.tableDataAcc = res.data.data.list;
        this.man.purchaseOrder = res.data.data.list[0].code;
        SelectOrderList(this.man).then((res) => {
          this.tableData = res.data.data.list;
          console.log("查询数据23", res);
        });
      })
    },
    //确定选择订单
    confirm24() {
      this.man.purchaseOrder = this.kan.code;
      SelectOrderList(this.man).then((res) => {
        this.tableData = res.data.data.list;
      });
      this.dialogVisiblefg = false;
    },
    //选择订单事件
    handleCurrentChange4e(val) {
      this.form.purchase = val.code
      this.kan = val;
    },

    handleCurrentChange(val) {
      this.currentRow = val;
    },
    //确认取消
    handleCancel() {
      this.$router.go(-1)
    },
    handleConfirm() {
      this.form.tableData3 = this.tableData3
      this.form.documents = this.documents
      InsertAcceptance(this.form).then((res) => {
        if (parseInt(res.data.code) == 520) {
          this.$router.go(-1);
        }
      })
    },
    //选择人员
    confirmSelection() {
      this.form.acceptor = this.selectedNodes[0].label
      this.centerDialogVisible = false;
    },
    handleNodeClick(data) {
      if (!this.selectedNodes.includes(data) && data.children == null) {
        this.selectedNodes = []
        this.selectedNodes.push(data);
      }
    },
    removeNode(node) {
      this.selectedNodes = this.selectedNodes.filter(n => n !== node);
    },
    clearSelection() {
      this.selectedNodes = [];
    },
    //选择人员
    xuanz() {
      this.centerDialogVisible = true
    },
    //选择部门
    handleNodeClick2(data) {
      console.log("选择数据", data)
      if (!this.selectedNodes2.includes(data) && data.children == null) {
        this.selectedNodes2 = []
        this.selectedNodes2.push(data);
      }
    },
    removeNode2(node) {
      this.selectedNodes2 = this.selectedNodes2.filter(n => n !== node);
    },
    clearSelection2() {
      this.selectedNodes2 = [];
    },
    confirmSelection23() {
      this.form.department = this.selectedNodes2[0].label
      this.centerDialogVisible2 = false
    },
    //验收确认
    confirm4() {
      console.log(this.formData);
      this.dialogVisible3 = false;
    },
    //添加采购货物
    search() {
      // 执行查询操作
    },
    reset() {
      // 重置搜索条件
      this.countype = '',
        this.councode = '',
        this.counbu = ''
    },
    handleSizeChange(size) {
      console.log(`每页 ${size} 条`);
    },
    handleCurrentChange(page) {
      console.log(`当前页: ${page}`);
    },
    confirm2() {
      // 处理确认操作
      if (this.tableData3.length == 0) {
        for (let i = 0; i < this.filteredData2.length; i++) {
          this.tableData3.push({
            id: this.filteredData2[i].id,
            numbering: this.filteredData2[i].numbering,
            name: this.filteredData2[i].name,
            model: this.filteredData2[i].model,
            type: this.filteredData2[i].type,
            brand: this.filteredData2[i].brand,
            jieg: this.filteredData2[i].jieg,
            actual: this.filteredData2[i].actual,
            daohuo: this.filteredData2[i].daohuo,
            weidaohuo: this.filteredData2[i].weidaohuo,
            daoqi: this.filteredData2[i].daoqi,
            benci: this.filteredData2[i].benci,
            manufacture: this.filteredData2[i].manufacture,
            manufacturer: this.filteredData2[i].manufacturer,
            factoryNumber: this.filteredData2[i].factoryNumber,
            dateofManufacture: this.filteredData2[i].dateofManufacture,
            totalPower: this.filteredData2[i].totalPower,
            weight: this.filteredData2[i].weight,
            actualPrice: this.filteredData2[i].actualPrice,
            actualTotal: this.filteredData2[i].actualTotal,
            actual: this.filteredData2[i].actual,
            remark: this.filteredData2[i].remark,
            useDepartments: this.filteredData2[i].useDepartments,
            theEquipment: this.filteredData2[i].theEquipment,
            qingk: this.filteredData2[i].qingk,
            listData: [],
            tableData: []
          });
        }
      } else {
        for (let i = 0; i < this.tableData3.length; i++) {
          for (let j = 0; j < this.filteredData2.length; j++) {
            if (this.tableData3[i].numbering == this.filteredData2[j].numbering) {
              // this.tableData3[i].quantity += 1;
              this.filteredData2.splice(j, 1);
            }
          }
        }

        for (let i = 0; i < this.filteredData2.length; i++) {
          this.tableData3.push({
            id: this.filteredData2[i].id,
            numbering: this.filteredData2[i].numbering,
            name: this.filteredData2[i].name,
            model: this.filteredData2[i].model,
            type: this.filteredData2[i].type,
            brand: this.filteredData2[i].brand,
            jieg: this.filteredData2[i].jieg,
            actual: this.filteredData2[i].actual,
            daohuo: this.filteredData2[i].daohuo,
            weidaohuo: this.filteredData2[i].weidaohuo,
            manufacture: this.filteredData2[i].manufacture,
            manufacturer: this.filteredData2[i].manufacturer,
            factoryNumber: this.filteredData2[i].factoryNumber,
            dateofManufacture: this.filteredData2[i].dateofManufacture,
            weight: this.filteredData2[i].weight,
            actualPrice: this.filteredData2[i].actualPrice,
            actualTotal: this.filteredData2[i].actualTotal,
            actual: this.filteredData2[i].actual,
            remark: this.filteredData2[i].remark,
            useDepartments: this.filteredData2[i].useDepartments,
            theEquipment: this.filteredData2[i].theEquipment,
            qingk: this.filteredData2[i].qingk,
            listData: [],
            tableData: []
          });
        }
      }
      console.log("查询数据gh3", this.tableData3);
      this.$refs.registTable2.clearSelection();
      this.dialogVisible2 = false;
    },
    //关联文件上传
    removeRow3(index) {
      this.documents.splice(index, 1);
    },
    handleSelectionChange2(val) {
      this.multipleSelection = val;
    },
    removeSelectedRows2() {
      this.documents = this.documents.filter(
        (item) => !this.multipleSelection.includes(item)
      );
    },
    //文件上传成功时候
    handleUploadSuccess2(response, file, fileList) {
      this.documents.push({
        name: file.name,
        url: file.url,
        uploadDate: new Date().toLocaleDateString('zh').replaceAll('/', '-'),
        uploader: this.$store.state.user.name,
        size: file.size + " KB",
      });
      console.log("数据2", this.documents);
    },
    //添加附件
    addRow2() {
      this.tableData2.push({
        code: "自动生成编码",
        numbering: "自动生成编码",
        name: "",
        model: "",
        type: "",
        quantity: "",
        remark: "",
      })
    },
    removeRow2(index) {
      this.tableData2.splice(index, 1);
      this.updateIndices2();
    },
    removeSelected2r() {
      const selected = this.$refs.registTable.selection;
      this.tableData2 = this.tableData2.filter(
        (item) => !selected.includes(item)
      );
    },
    updateIndices2() {
      this.tableData.forEach((item, index) => {
        item.index = index + 1;
      });
    },
    confirm() {
      // 在确认时处理数据
      this.tableData3[this.uindex].tableData = this.tableData2
      console.log("zhang", this.tableData3);
      this.dialogVisible = false;
    },
    addRow() {

    },
    removeRow(index) {
      this.tableData3.splice(index, 1);
      this.updateIndices();
    },
    removeSelected() {
      const selected = this.$refs.registTable2g.selection;
      this.tableData3 = this.tableData3.filter(
        (item) => !selected.includes(item)
      );
    },
    updateIndices() {
      this.tableData.forEach((item, index) => {
        item.index = index + 1;
      });
    }
  },
};
</script>

<style scoped>
.box-card5xx {
  width: 200px;
  height: 300px;
}

.fixed-footer-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.footer {
  text-align: center;
  background-color: #eeeded;
  position: fixed;
  bottom: 0;
  z-index: 12;
  width: 100%;
}

.box-cardxx {
  width: 1254px;
  margin-left: 30px;
  margin-top: 20px;
  height: 380px;
}

.box-card2tt {
  width: 1254px;
  margin-left: 30px;
  margin-top: 20px;
}

.box-card3xx {
  width: 1254px;
  margin-left: 30px;
  margin-top: 20px;
}
</style>
